package com.tddx.activiti.business.core.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tddx.activiti.business.core.dao.GentiDao;
import com.tddx.activiti.business.core.entity.UserTabColsEntity;
import com.tddx.activiti.utils.ftl.FtlUtil;
import com.tddx.activiti.utils.ftl.data.BaseData;

@Controller
@RequestMapping("genti")
public class GentiContoller {
	
	@Autowired GentiDao dao;
	
	@RequestMapping("findCols")
	@ResponseBody
	public Object findCols(String tableName, ModelMap map){
		List<UserTabColsEntity> cols = dao.findCols(tableName);
		map.put("cols", cols);
		return cols;
	}
	
	@RequestMapping("java")
	@ResponseBody
	public Object getntiJava(String tableName){
		BaseData data = BaseData.getInstance(tableName);
		FtlUtil.makeControllerFtl(data);
		FtlUtil.makeServiceFtl(data);
		FtlUtil.makeDaoFtl(data);
		FtlUtil.makeEntityFtl(data);
		return "success";
	}
	
}
